#ifndef _DOUBLECIRCLELINKEDLIST_H_
#define _DOUBLECIRCLELINKEDLIST_H_

#define Status int
#define OK 1
#define ERROR 0
#define TRUE 1
#define FALSE 0

typedef int ElemType;

// 循环链表可以设置尾指针 来简化操作
typedef struct Node
{
    ElemType data;
    struct Node *prev;
    struct Node *next;
} Node, *DoubleCircleLinkedList;

// 初始化链表
Status InitList(DoubleCircleLinkedList *list);

// 链表是否为空
int ListIsEmpty(DoubleCircleLinkedList list);

// 销毁链表
Status DestroyList(DoubleCircleLinkedList *list);

// 获取链表长度
unsigned int ListLength(DoubleCircleLinkedList list);

// 获取指定位置的元素,  index可取范围是 1 - 链表的长度
Status GetElem(DoubleCircleLinkedList list, int index, ElemType *e);

// 在指定位置插入元素
Status InsertElem(DoubleCircleLinkedList list, int index, ElemType e);

/**
 * 删除指定位置的数据
 */
Status DeleteElem(DoubleCircleLinkedList *list, int index, ElemType *e);

#endif